import time

from utils.bilibili_control import BilibiliHandler

# 默认下载视频（1080P），如果想只下载音频，还需要传递关键字参数：download_type=2
if __name__ == '__main__':
    i = 1
    j_js = 2 #视频选集里的集数
    while i < j_js+1:

        # j_wz = f'https://www.bilibili.com/video/BV1ArqfY6EMr?spm_id_from=333.788.videopod.episodes&vd_source=5289f3f9676994046d4da1405f59205a&p={i}'
        j_wzq = "https://www.bilibili.com/video/BV1F8puzPE7d/?spm_id_from=333.1007.tianma.2-1-4.click&vd_source=5289f3f9676994046d4da1405f59205a"
        j_wz = j_wzq.split('?')[0]+f'?p={i}'
        # j_wz = f'https://www.bilibili.com/video/BV1Gr421G7Qc?&p={i}'
        print(f'网址： {j_wz}')
        # break
        bilibili = BilibiliHandler(
            j_wz
        )
        bilibili.run()
        print(f'已完成 {i} 个视频下载')

        i += 1
        time.sleep(3)


    # bilibili = BilibiliHandler(
    #     'https://www.bilibili.com/video/BV1L3N8e1ErY/?spm_id_from=444.41.list.card_'
    #     'archive.click&vd_source=2c47cae239125c0e46b5fa7bc850849f'
    #
    # )
    # bilibili.run()

